import { Metadata } from 'next';
import Link from 'next/link';
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import {
  ArrowRight,
  TrendingUp,
  Database,
  CreditCard,
  Shield,
} from 'lucide-react';

export const metadata: Metadata = {
  title: 'CActor金融解决方案 | 企业级Actor框架 - 高频交易、实时支付、智能风控',
  description:
    'CActor在金融领域的完整解决方案：高频交易系统(微秒级延迟)、分布式账本、实时支付处理、智能风控系统。基于仓颉语言的企业级Actor框架，为金融科技提供649K req/s性能保障。',
  keywords: [
    'CActor金融解决方案',
    '高频交易系统',
    '分布式账本',
    '实时支付处理',
    '智能风控',
    'Actor框架',
    '仓颉语言',
    '金融科技',
    '企业级',
    '微秒级延迟',
    '649K req/s',
    'TPS',
    '容错恢复',
    'AI风控',
    '事件溯源',
  ],
  openGraph: {
    title: 'CActor金融解决方案 | 企业级Actor框架',
    description:
      'CActor在金融领域的完整解决方案：高频交易、分布式账本、实时支付处理、智能风控系统',
    url: 'https://cactor.dev/solutions',
    siteName: 'CActor',
    images: [
      {
        url: '/solutions-og-image.png',
        width: 1200,
        height: 630,
        alt: 'CActor金融解决方案',
      },
    ],
    locale: 'zh_CN',
    type: 'website',
  },
  twitter: {
    card: 'summary_large_image',
    title: 'CActor金融解决方案 | 企业级Actor框架',
    description:
      'CActor在金融领域的完整解决方案：高频交易、分布式账本、实时支付处理、智能风控系统',
    images: ['/solutions-twitter-image.png'],
  },
  alternates: {
    canonical: '/solutions',
  },
};

/**
 * 金融解决方案主页面组件
 * 展示CActor在金融领域的四大核心解决方案
 */
export default function SolutionsPage() {
  const solutions = [
    {
      id: 'high-frequency-trading',
      title: '高频交易系统',
      description:
        '基于CActor构建的超低延迟交易系统，支持微秒级响应和百万级TPS',
      icon: TrendingUp,
      features: ['微秒级延迟', '百万TPS', '容错恢复', '实时监控'],
      color: 'bg-blue-500',
      href: '/solutions/high-frequency-trading',
    },
    {
      id: 'distributed-ledger',
      title: '分布式账本',
      description:
        '采用事件溯源和CQRS模式的分布式账本系统，确保数据一致性和可追溯性',
      icon: Database,
      features: ['事件溯源', 'CQRS架构', '数据一致性', '水平扩展'],
      color: 'bg-green-500',
      href: '/solutions/distributed-ledger',
    },
    {
      id: 'real-time-payment',
      title: '实时支付处理',
      description: '基于流处理的实时支付系统，支持背压控制和故障自动恢复',
      icon: CreditCard,
      features: ['流处理', '背压控制', '故障恢复', '性能优化'],
      color: 'bg-purple-500',
      href: '/solutions/real-time-payment',
    },
    {
      id: 'intelligent-risk-control',
      title: '智能风控系统',
      description: 'AI驱动的实时风控决策引擎，基于Actor模型的分布式风险评估',
      icon: Shield,
      features: ['AI决策', '实时评估', '规则引擎', '可视化监控'],
      color: 'bg-red-500',
      href: '/solutions/intelligent-risk-control',
    },
  ];

  return (
    <div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800">
      {/* Hero Section */}
      <section className="relative py-20 px-4">
        <div className="max-w-7xl mx-auto text-center">
          <Badge variant="outline" className="mb-4">
            金融科技解决方案
          </Badge>
          <h1 className="text-4xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
            CActor金融解决方案
          </h1>
          <p className="text-xl text-muted-foreground mb-8 max-w-3xl mx-auto">
            基于CActor框架构建的企业级金融解决方案，为高频交易、分布式账本、实时支付和智能风控提供完整的技术架构
          </p>
          <div className="flex flex-wrap justify-center gap-4 mb-12">
            <Badge variant="secondary">649K req/s 性能</Badge>
            <Badge variant="secondary">微秒级延迟</Badge>
            <Badge variant="secondary">7层架构设计</Badge>
            <Badge variant="secondary">企业级可靠性</Badge>
          </div>
        </div>
      </section>

      {/* Solutions Grid */}
      <section className="py-16 px-4">
        <div className="max-w-7xl mx-auto">
          <div className="grid grid-cols-1 md:grid-cols-2 gap-8">
            {solutions.map(solution => {
              const IconComponent = solution.icon;
              return (
                <Card
                  key={solution.id}
                  className="group hover:shadow-xl transition-all duration-300 border-0 bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm"
                >
                  <CardHeader className="pb-4">
                    <div className="flex items-center gap-4 mb-4">
                      <div
                        className={`p-3 rounded-lg ${solution.color} text-white`}
                      >
                        <IconComponent className="h-6 w-6" />
                      </div>
                      <div>
                        <CardTitle className="text-xl group-hover:text-blue-600 transition-colors">
                          {solution.title}
                        </CardTitle>
                      </div>
                    </div>
                    <CardDescription className="text-base leading-relaxed">
                      {solution.description}
                    </CardDescription>
                  </CardHeader>
                  <CardContent>
                    <div className="flex flex-wrap gap-2 mb-6">
                      {solution.features.map(feature => (
                        <Badge
                          key={feature}
                          variant="outline"
                          className="text-xs"
                        >
                          {feature}
                        </Badge>
                      ))}
                    </div>
                    <Link href={solution.href}>
                      <Button className="w-full group-hover:bg-blue-600 transition-colors">
                        了解详情
                        <ArrowRight className="ml-2 h-4 w-4 group-hover:translate-x-1 transition-transform" />
                      </Button>
                    </Link>
                  </CardContent>
                </Card>
              );
            })}
          </div>
        </div>
      </section>

      {/* CTA Section */}
      <section className="py-20 px-4">
        <div className="max-w-4xl mx-auto text-center">
          <h2 className="text-3xl font-bold mb-6">
            准备开始您的金融科技项目？
          </h2>
          <p className="text-lg text-muted-foreground mb-8">
            联系我们的专家团队，获取定制化的CActor金融解决方案
          </p>
          <div className="flex flex-col sm:flex-row gap-4 justify-center">
            <Button size="lg" className="bg-blue-600 hover:bg-blue-700">
              联系专家咨询
            </Button>
            <Button size="lg" variant="outline">
              下载技术白皮书
            </Button>
          </div>
        </div>
      </section>
    </div>
  );
}
